/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dtd.implementation;

import java.text.DecimalFormat;
import java.util.StringTokenizer;

/**
 *
 * @author TQD
 */
public class CustomParser {

    public static double parseDouble(String value) {
        try {
            return Double.parseDouble(value);
        } catch (Exception e) {
            return 0.00;
        }
    }

   

    public static String tokenRemove(String value) {
        try {
             if ("".equals(value)) {
            return "0";
        }
        return new StringTokenizer(value, "/").nextElement().toString().trim();
        } catch (Exception e) {
            return "0";
        }
    }

    public static double round2Decimals(double d) {
        DecimalFormat twoDForm = new DecimalFormat("#.##");
        try {
            return Double.valueOf(twoDForm.format(d));
        } catch (Exception e) {
            return 0;
        }
        
    }
}
